﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace Indeco.G24.Website.UserControls
{
    public partial class ListNhaCungCap : System.Web.UI.UserControl, ITemplate
    {      
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        void ITemplate.InstantiateIn(Control container)
        {
            container.Controls.Add(this);
        }

        protected void navBarNhaCungCapActive_GroupDataBound(object source, DevExpress.Web.ASPxNavBar.NavBarGroupEventArgs e)
        {
            SiteMapNode siteMapNode = (e.Group.DataItem as IHierarchyData).Item as SiteMapNode;
            Control ucContentTemplate = LoadControl("~/UserControls/ListBangGia.ascx");
            e.Group.ContentTemplate = ucContentTemplate as ITemplate;
            DataBindContentUserControl(siteMapNode, ucContentTemplate);
        }
        protected void DataBindContentUserControl(SiteMapNode siteMapNode, Control userControl)
        {
            Label lblNhaCungCap = userControl.FindControl("lblIDNhaCungCap") as Label;
            Label lblDiaBan = userControl.FindControl("lblIDDiaBan") as Label;
            lblNhaCungCap.Text = siteMapNode.Key.ToString().Substring(41,36);
            lblDiaBan.Text = ProvinceSiteMapDataSourceNhaCungCap.StartingNodeUrl.ToString().Substring(34,36);
        }
    }
}